package com.ddy.test.singleton;

import org.junit.Test;

/**
 * Created by ddy on 2020/4/20 11:41 AM
 */

public class EnumSingleton {

    private EnumSingleton(){}


    private enum Singleton{
        INSTANCE;
        private EnumSingleton instance;

        Singleton(){
            instance = new EnumSingleton();
        }

        private EnumSingleton getInstance(){
            return instance;
        }

    }
    public static void log(String name){
        System.out.println(name + " write log : " + getInstance());
    }


    public static EnumSingleton getInstance(){
        return Singleton.INSTANCE.instance;
    }




}

